<?php
/**
 * Модель text
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель text
 *
 */
class ModelText extends Model {
	
	const TABLE				= 'text';
	const F_LANG_ID  	= 'lang_id';
	const F_MODEL_ID  	= 'model_id';
	const F_MODEL  	= 'model';
	const F_TITLE  	= 'title';
	const F_DESCRIPTION  	= 'description';
	const F_HUMAN  	= 'human';
	const F_SEARCH  	= 'search';
	const F_DELETED  	= 'deleted';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='text';
		$this->id_field=array(self::F_LANG_ID,self::F_MODEL_ID,self::F_MODEL);
		$this->fields=array(
		self::TABLE.DOT.self::F_LANG_ID=> new Field($this,self::F_LANG_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>2,
				'join_table'=>'lang')),
		self::TABLE.DOT.self::F_MODEL_ID=> new Field($this,self::F_MODEL_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>11)),
		self::TABLE.DOT.self::F_MODEL=> new Field($this,self::F_MODEL,self::TABLE,array(
				'important'=>true,
				'lenght'=>20,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_TITLE=> new Field($this,self::F_TITLE,self::TABLE,array(
				'lenght'=>255,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_DESCRIPTION=> new Field($this,self::F_DESCRIPTION,self::TABLE,array(
				'type'=>Field::TYPE_TEXT)),
		self::TABLE.DOT.self::F_HUMAN=> new Field($this,self::F_HUMAN,self::TABLE,array(
				'important'=>true,
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL)),
		self::TABLE.DOT.self::F_SEARCH=> new Field($this,self::F_SEARCH,self::TABLE,array(
				'type'=>Field::TYPE_TEXT)),
		self::TABLE.DOT.self::F_DELETED=> new Field($this,self::F_DELETED,self::TABLE,array(
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL))		);
	}
}
